#pragma once
#include <vector> 
#include <thread>
#include "Guard.h"
#include "ThreadMutex.h" 
#include "SelectReactor.h"

#define THREAD_LOCK_TIMEOUT_MS 1000

namespace Network
{
	class SelectReactor;

	class LFThreadPool
	{
	public:
		LFThreadPool(SelectReactor* reactor, unsigned int threadCount);
		~LFThreadPool(void);
		DWORD Join( DWORD timeout_ms );
		void PromoteNewLeader();
		void Start();
		void Stop();

		void DeactivateHandle(HANDLE h, EventType et);
		void ActivateHandle(HANDLE h, EventType et);

	private:
		SelectReactor* iReactor;
		DWORD iLeaderThread;
		bool iIsRunning; 
	};
}